package com.zz.tijian.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfig {
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2) // 或者 DocumentationType.OAS_30
                .select()// 指定扫描的包
                .apis(RequestHandlerSelectors.basePackage("com.zz.tijian.controller"))// 指定扫描的包
                .paths(PathSelectors.any())// 指定扫描的URL
                .build()
                .apiInfo(apiInfo());
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("熙心体检项目API")
                .description("熙心体检项目的API文档")
                .version("1.0")
                .contact(new Contact("张喆琦AND曾亮", "https://blog.csdn.net/jjgwawsl", "1795805600@qq.com"))
                .build();
    }
}
